<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>AmpleHarvest: markDataAsRead.php Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">AmpleHarvest
   &#160;<span id="projectnumber">0.0.1</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('mark_data_as_read_8php.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">markDataAsRead.php</div>  </div>
</div>
<div class="contents">
<a href="mark_data_as_read_8php.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 &lt;?php
<a name="l00002"></a>00002         use\ampleharvest\code\cRestConnector;
<a name="l00003"></a>00003         use\ampleharvest\code\cRestServices;
<a name="l00004"></a>00004         use\ampleharvest\code\cConfig;
<a name="l00005"></a>00005 
<a name="l00006"></a>00006         require_once dirname(dirname(dirname(__FILE__))) . <span class="stringliteral">&quot;/classes/cThread.php&quot;</span>;
<a name="l00007"></a>00007         require_once dirname(dirname(dirname(__FILE__))) . <span class="stringliteral">&#39;/classes/cStomp.php&#39;</span>;
<a name="l00008"></a>00008         require_once dirname(dirname(dirname(__FILE__))) . <span class="stringliteral">&quot;/config/cRestServices.php&quot;</span>;
<a name="l00009"></a>00009         require_once dirname(dirname(dirname(__FILE__))) . <span class="stringliteral">&quot;/classes/cRestConnector.php&quot;</span>;
<a name="l00010"></a>00010         require_once dirname(dirname(dirname(__FILE__))) . <span class="stringliteral">&#39;/classes/cAmpleHarvestLog.php&#39;</span>;
<a name="l00011"></a>00011 
<a name="l00012"></a><a class="code" href="mark_data_as_read_8php.html#a1eb623d439b7e7518cbe55c7038545c2">00012</a>         <a class="code" href="namespaceampleharvest_1_1task_1_1index__data.html#a1eb623d439b7e7518cbe55c7038545c2">$arr_Params</a> = array(
<a name="l00013"></a>00013                 <span class="stringliteral">&quot;username::&quot;</span>,
<a name="l00014"></a>00014                 <span class="stringliteral">&quot;id::&quot;</span>
<a name="l00015"></a>00015         );
<a name="l00016"></a>00016 
<a name="l00017"></a><a class="code" href="mark_data_as_read_8php.html#a9bb2f410a4a3fbd242c6aecf5ed6c02d">00017</a>         <a class="code" href="namespaceampleharvest_1_1task_1_1index__data.html#a9bb2f410a4a3fbd242c6aecf5ed6c02d">$arr_Options</a> = getopt(<span class="stringliteral">&quot;&quot;</span>, <a class="code" href="namespaceampleharvest_1_1task_1_1index__data.html#a1eb623d439b7e7518cbe55c7038545c2">$arr_Params</a>);
<a name="l00018"></a>00018 
<a name="l00019"></a><a class="code" href="mark_data_as_read_8php.html#aab9f1123c8bdb4add0f73d9e5eb6e788">00019</a>         <a class="code" href="mark_data_as_read_8php.html#aab9f1123c8bdb4add0f73d9e5eb6e788">$obj_MarkDataAsRead</a> = <span class="keyword">new</span> <a class="code" href="classc_mark_data_as_read.html">cMarkDataAsRead</a>(<a class="code" href="namespaceampleharvest_1_1task_1_1index__data.html#a9bb2f410a4a3fbd242c6aecf5ed6c02d">$arr_Options</a>[<span class="stringliteral">&#39;username&#39;</span>], <a class="code" href="namespaceampleharvest_1_1task_1_1index__data.html#a9bb2f410a4a3fbd242c6aecf5ed6c02d">$arr_Options</a>[<span class="stringliteral">&#39;id&#39;</span>]);
<a name="l00020"></a>00020 
<a name="l00021"></a><a class="code" href="classc_mark_data_as_read.html">00021</a>         <span class="keyword">class </span><a class="code" href="classc_mark_data_as_read.html">cMarkDataAsRead</a>
<a name="l00022"></a>00022         {
<a name="l00023"></a><a class="code" href="classc_mark_data_as_read.html#aa4af8856b0bd2334f7c4f159771b73f8">00023</a>                 <span class="keyword">private</span> <a class="code" href="classc_mark_data_as_read.html#aa4af8856b0bd2334f7c4f159771b73f8">$m_str_UserName</a>;
<a name="l00024"></a><a class="code" href="classc_mark_data_as_read.html#afd79d34003d65e8f5c026aed9caeac48">00024</a>                 <span class="keyword">private</span> <a class="code" href="classc_mark_data_as_read.html#afd79d34003d65e8f5c026aed9caeac48">$m_str_ID</a>;
<a name="l00025"></a><a class="code" href="classc_mark_data_as_read.html#a37aaa0b4692043a751c56d5941c4117f">00025</a>                 <span class="keyword">private</span> <a class="code" href="classc_mark_data_as_read.html#a37aaa0b4692043a751c56d5941c4117f">$m_obj_Log</a>;
<a name="l00026"></a>00026 
<a name="l00027"></a><a class="code" href="classc_mark_data_as_read.html#a75f84da7ead340dc8fcee14fdf365c8e">00027</a>                 <span class="keyword">private</span> <a class="code" href="classc_mark_data_as_read.html#a75f84da7ead340dc8fcee14fdf365c8e">$m_arr_Views</a>;
<a name="l00028"></a>00028 
<a name="l00029"></a><a class="code" href="classc_mark_data_as_read.html#ae6b1f98ccecf2299d324811b71c237c3">00029</a>                 <span class="keyword">private</span> <span class="keyword">static</span> <a class="code" href="classc_mark_data_as_read.html#ae6b1f98ccecf2299d324811b71c237c3">$m_obj_RestCon</a> = null;
<a name="l00030"></a><a class="code" href="classc_mark_data_as_read.html#a0c6c1e1fdcf5ae4bde4fd16249a084d8">00030</a>                 <span class="keyword">private</span> <span class="keyword">static</span> <a class="code" href="classc_mark_data_as_read.html#a0c6c1e1fdcf5ae4bde4fd16249a084d8">$m_obj_STOMP</a> = null;
<a name="l00031"></a>00031 
<a name="l00032"></a><a class="code" href="classc_mark_data_as_read.html#a85157c6774cc75630fd7166216d71593">00032</a>                 <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classc_mark_data_as_read.html#a85157c6774cc75630fd7166216d71593">get_RestCon</a>()
<a name="l00033"></a>00033                 {
<a name="l00034"></a>00034                         <span class="keywordflow">if</span> (!self::$m_obj_RestCon)
<a name="l00035"></a>00035                         {
<a name="l00036"></a>00036                                 self::$m_obj_RestCon = <span class="keyword">new</span> cRestConnector(cRestServices::get_Views($this-&gt;m_str_ID));
<a name="l00037"></a>00037                                 self::$m_obj_RestCon-&gt;set_Login(cConfig::C_STR_AMPLE_SILO_USER_NAME, cConfig::C_STR_AMPLE_SILO_PASSWORD);
<a name="l00038"></a>00038                         }
<a name="l00039"></a>00039 
<a name="l00040"></a>00040                         <span class="keywordflow">return</span> <a class="code" href="classc_mark_data_as_read.html#ae6b1f98ccecf2299d324811b71c237c3">self::$m_obj_RestCon</a>;
<a name="l00041"></a>00041                 }
<a name="l00042"></a>00042 
<a name="l00043"></a><a class="code" href="classc_mark_data_as_read.html#a669c7cba234f1088141fb6fccaf74a11">00043</a>                 <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classc_mark_data_as_read.html#a669c7cba234f1088141fb6fccaf74a11">getCurrentViews</a>()
<a name="l00044"></a>00044                 {
<a name="l00045"></a>00045                         <a class="code" href="move2_h_d_f_s___chunk_8php.html#abb692cbe102c3169dcbde3f99af9c39f">$obj_RestCon</a> = $this-&gt;<a class="code" href="classc_mark_data_as_read.html#a85157c6774cc75630fd7166216d71593">get_RestCon</a>();
<a name="l00046"></a>00046                         <span class="keywordflow">return</span> <a class="code" href="move2_h_d_f_s___chunk_8php.html#abb692cbe102c3169dcbde3f99af9c39f">$obj_RestCon</a>-&gt;send_Get();
<a name="l00047"></a>00047                 }
<a name="l00048"></a>00048 
<a name="l00049"></a><a class="code" href="classc_mark_data_as_read.html#a2051465516e28bdc9ed627087ff6727f">00049</a>                 <span class="keyword">public</span> <span class="keyword">function</span> <a class="code" href="classc_mark_data_as_read.html#a2051465516e28bdc9ed627087ff6727f">__construct</a>($str_UserName, <a class="code" href="task__runner_8php.html#a638f33f9a90952d7cebdf44588e8f40b">$str_ID</a>)
<a name="l00050"></a>00050                 {
<a name="l00051"></a>00051                         $this-&gt;m_str_ID = <a class="code" href="task__runner_8php.html#a638f33f9a90952d7cebdf44588e8f40b">$str_ID</a>;
<a name="l00052"></a>00052                         $this-&gt;m_str_UserName = $str_UserName;
<a name="l00053"></a>00053                         $this-&gt;m_obj_Log = new \cAmpleHarvestLog();
<a name="l00054"></a>00054 
<a name="l00055"></a>00055                         $str_Content = $this-&gt;<a class="code" href="classc_mark_data_as_read.html#a669c7cba234f1088141fb6fccaf74a11">getCurrentViews</a>();
<a name="l00056"></a>00056                         <span class="keywordflow">if</span> (!$str_Content)
<a name="l00057"></a>00057                         {
<a name="l00058"></a>00058                                 $this-&gt;<a class="code" href="classc_mark_data_as_read.html#a879a69722509fe6f6cd2682d7b4b3f90">add_User2Read</a>();
<a name="l00059"></a>00059                                 <span class="keywordflow">return</span>;
<a name="l00060"></a>00060                         }
<a name="l00061"></a>00061 
<a name="l00062"></a>00062                         <span class="comment">//$this-&gt;m_arr_Views = json_decode($str_Content);</span>
<a name="l00063"></a>00063 
<a name="l00064"></a>00064                         <span class="keywordflow">if</span> (!$this-&gt;m_arr_Views)
<a name="l00065"></a>00065                         {
<a name="l00066"></a>00066                                 $this-&gt;<a class="code" href="classc_mark_data_as_read.html#a879a69722509fe6f6cd2682d7b4b3f90">add_User2Read</a>();
<a name="l00067"></a>00067                                 <span class="keywordflow">return</span>;
<a name="l00068"></a>00068                         }
<a name="l00069"></a>00069 
<a name="l00070"></a>00070                         <span class="keywordflow">if</span> (!isset($this-&gt;m_arr_Views-&gt;$str_UserName))
<a name="l00071"></a>00071                         {
<a name="l00072"></a>00072                                 $this-&gt;<a class="code" href="classc_mark_data_as_read.html#a879a69722509fe6f6cd2682d7b4b3f90">add_User2Read</a>();
<a name="l00073"></a>00073                                 <span class="keywordflow">return</span>;
<a name="l00074"></a>00074                         }
<a name="l00075"></a>00075                 }
<a name="l00076"></a>00076 
<a name="l00077"></a><a class="code" href="classc_mark_data_as_read.html#a879a69722509fe6f6cd2682d7b4b3f90">00077</a>                 <span class="keyword">function</span> <a class="code" href="classc_mark_data_as_read.html#a879a69722509fe6f6cd2682d7b4b3f90">add_User2Read</a>()
<a name="l00078"></a>00078                 {
<a name="l00079"></a>00079                         <span class="keywordflow">if</span> (!is_object($this-&gt;m_arr_Views))
<a name="l00080"></a>00080                         {
<a name="l00081"></a>00081                                 $this-&gt;m_arr_Views = new \stdClass();
<a name="l00082"></a>00082                         }
<a name="l00083"></a>00083 
<a name="l00084"></a>00084                         $str_UserName = $this-&gt;m_str_UserName;
<a name="l00085"></a>00085 
<a name="l00086"></a>00086                         $this-&gt;m_arr_Views-&gt;$str_UserName = $str_UserName;
<a name="l00087"></a>00087 
<a name="l00088"></a>00088                         <a class="code" href="move2_h_d_f_s___chunk_8php.html#abb692cbe102c3169dcbde3f99af9c39f">$obj_RestCon</a> = $this-&gt;<a class="code" href="classc_mark_data_as_read.html#a85157c6774cc75630fd7166216d71593">get_RestCon</a>();
<a name="l00089"></a>00089                         <a class="code" href="move2_h_d_f_s___chunk_8php.html#abb692cbe102c3169dcbde3f99af9c39f">$obj_RestCon</a>-&gt;set_Url(cRestServices::put_Views());
<a name="l00090"></a>00090 
<a name="l00091"></a>00091                         <a class="code" href="move2_h_d_f_s___chunk_8php.html#abb692cbe102c3169dcbde3f99af9c39f">$obj_RestCon</a>-&gt;set_Param(<span class="stringliteral">&quot;viewContent&quot;</span>, json_encode($this-&gt;m_arr_Views));
<a name="l00092"></a>00092                         <a class="code" href="move2_h_d_f_s___chunk_8php.html#abb692cbe102c3169dcbde3f99af9c39f">$obj_RestCon</a>-&gt;set_Param(<span class="stringliteral">&quot;id&quot;</span>, $this-&gt;m_str_ID);
<a name="l00093"></a>00093 
<a name="l00094"></a>00094                         <a class="code" href="move2_h_d_f_s___chunk_8php.html#abb692cbe102c3169dcbde3f99af9c39f">$obj_RestCon</a>-&gt;send_Put();
<a name="l00095"></a>00095                         $this-&gt;<a class="code" href="classc_mark_data_as_read.html#a91355b8cf80b897eebcb202aa743d0a9">queue4Update</a>();
<a name="l00096"></a>00096 
<a name="l00097"></a>00097                 }
<a name="l00098"></a>00098 
<a name="l00099"></a><a class="code" href="classc_mark_data_as_read.html#a91355b8cf80b897eebcb202aa743d0a9">00099</a>                 <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classc_mark_data_as_read.html#a91355b8cf80b897eebcb202aa743d0a9">queue4Update</a>()
<a name="l00100"></a>00100                 {
<a name="l00101"></a>00101                         $obj_STOMP = $this-&gt;<a class="code" href="classc_mark_data_as_read.html#ac8dc3bd9918357623e4a6c5d5515d8fe">get_STOMP</a>();
<a name="l00102"></a>00102 
<a name="l00103"></a>00103                         $obj_STOMP-&gt;send(\<a class="code" href="classc_stomp.html#a3f1bdbcd7df017d0fe207e333d5b9e92">cStomp::get_SolrIndexQueue</a>(), $this-&gt;m_str_ID, 1);
<a name="l00104"></a>00104 
<a name="l00105"></a>00105                         $str_Command = dirname(dirname(__FILE__)) . <span class="stringliteral">&quot;/tasks/task_runner.php --task=index_Data_Queue --optimize=0 &quot;</span>;
<a name="l00106"></a>00106                         exec(cConfig::C_STR_PATH_PHP . <span class="stringliteral">&quot; &quot;</span> . $str_Command);
<a name="l00107"></a>00107                 }
<a name="l00108"></a>00108 
<a name="l00109"></a><a class="code" href="classc_mark_data_as_read.html#ab6551619dc697d97589f741a795321a1">00109</a>                 <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classc_mark_data_as_read.html#ab6551619dc697d97589f741a795321a1">log</a>($str_Msg, $int_LogLevel = <a class="code" href="classc_ample_harvest_log.html#ac75ce249ff964cc240a65f2807cdd475">cAmpleHarvestLog::C_INT_LEVEL_INFO</a>)
<a name="l00110"></a>00110                 {
<a name="l00111"></a>00111                         $this-&gt;m_obj_Log-&gt;do_Log(<a class="code" href="classc_ample_harvest_log.html#ab2a782d3c071d8eb5b153216beece32f">cAmpleHarvestLog::C_STR_ACTION_TASK_INFO</a>,
<a name="l00112"></a>00112                                 <span class="stringliteral">&quot;Script - MarkDataAsRead - &quot;</span> . $str_Msg,
<a name="l00113"></a>00113                                 $int_LogLevel);
<a name="l00114"></a>00114                 }
<a name="l00115"></a>00115 
<a name="l00116"></a><a class="code" href="classc_mark_data_as_read.html#a96fce4c76b6102d8cd1e7361049e483d">00116</a>                 <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classc_mark_data_as_read.html#a96fce4c76b6102d8cd1e7361049e483d">log_Error</a>($str_Msg, $int_LogLevel = <a class="code" href="classc_ample_harvest_log.html#a483d683544db816b71891ee1a3010568">cAmpleHarvestLog::C_INT_LEVEL_ERRORS</a>)
<a name="l00117"></a>00117                 {
<a name="l00118"></a>00118                         $this-&gt;m_obj_Log-&gt;do_Log(<a class="code" href="classc_ample_harvest_log.html#afef0d8991975e8940cfcb0c4e2691616">cAmpleHarvestLog::C_STR_ACTION_TASK_ERROR</a>,
<a name="l00119"></a>00119                                 <span class="stringliteral">&quot;Script - MarkDataAsRead - &quot;</span> . $str_Msg,
<a name="l00120"></a>00120                                 $int_LogLevel);
<a name="l00121"></a>00121                 }
<a name="l00122"></a><a class="code" href="classc_mark_data_as_read.html#ac8dc3bd9918357623e4a6c5d5515d8fe">00122</a>                 <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classc_mark_data_as_read.html#ac8dc3bd9918357623e4a6c5d5515d8fe">get_STOMP</a>()
<a name="l00123"></a>00123                 {
<a name="l00124"></a>00124                         <span class="keywordflow">if</span> (!self::$m_obj_STOMP)
<a name="l00125"></a>00125                         {
<a name="l00126"></a>00126                                 self::$m_obj_STOMP = new \cStomp();
<a name="l00127"></a>00127                         }
<a name="l00128"></a>00128 
<a name="l00129"></a>00129                         <span class="keywordflow">return</span> <a class="code" href="classc_mark_data_as_read.html#a0c6c1e1fdcf5ae4bde4fd16249a084d8">self::$m_obj_STOMP</a>;
<a name="l00130"></a>00130                 }
<a name="l00131"></a>00131         }
<a name="l00132"></a>00132 
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="mark_data_as_read_8php.html">markDataAsRead.php</a>      </li>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>


    <li class="footer">Generated on Mon Jan 23 2012 13:34:20 for AmpleHarvest by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
